﻿using MediatR;
using S.RBAC.Domain.Model;
using S.RBAC.Infrastructure.Interface;
using S.RBAC.Read.Api.Application.Command.PostCommand;

namespace S.RBAC.Read.Api.Application.CommandHandlers.PostHandler
{
    public class PostGetAllCommandHandler : IRequestHandler<PostGetAllCommand, List<Post>>
    {
        protected readonly IPostRepository _post;

        public PostGetAllCommandHandler(IPostRepository post)
        {
            _post = post;
        }

        public async Task<List<Post>> Handle(PostGetAllCommand request, CancellationToken cancellationToken)
        {
            return await _post.GetAllPosts();
        }
    }
}
